package com.kxc.common;


import javax.servlet.http.HttpServletRequest;

import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

/**定义全局异常捕获类
 * @author 崔耀强
 * @Date 2018-05-21
 * @version 1.0.0
 */
@ControllerAdvice
public class GlobalExceptionCapture{
	
	@ResponseBody
	@ExceptionHandler(value = Exception.class)
	public String defaultErrorHandler(HttpServletRequest req, Exception e) {
		
		//打印异常信息：
		e.printStackTrace();
		LogUtil.recordErrorMsg(e);
		return "exception";
	}
}